package renmopr.tourguide.util;

import java.io.File;
import java.util.Iterator;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.druid.DruidPlugin;

import renmopr.tourguide.dao.Place;

public class ImageUtil {
	
	@SuppressWarnings("unused")
	private static final Logger logger = LoggerFactory.getLogger(ImageUtil.class);

	public static void main(String[] args) {
		// 【配置数据库】
		String localhost = "jdbc:mysql://101.200.178.183/dev_shanghaitour?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false";
		String userName = "root";
		String password = "Xw23535300.";
		DruidPlugin dp = new DruidPlugin(localhost, userName, password);
	    ActiveRecordPlugin arp = new ActiveRecordPlugin(dp);
	    arp.addMapping("place", Place.class);
	    dp.start();
	    arp.start();
	    
	    Iterator<File> files = FileUtils.iterateFiles(new File("d:\\imgs"), new String[]{"jpg","png"}, false);
	    File file = null;
	    while(files.hasNext()) {
	    	file = files.next();
	    	System.out.println("file: " + file.getName()	);
	    }
	}
}
